import request from "@/request";

interface AreaInfo {
  code: string | undefined;
  name: string | undefined;
  pcode: string | undefined;
  level: string | undefined;
}

export const defaultValue = {
  province: {
    code: "",
    pcode: "",
    level: "",
    name: "",
  },
  city: {
    code: "",
    pcode: "",
    level: "",
    name: "",
  },
  country: {
    code: "",
    pcode: "",
    level: "",
    name: "",
  },
  town: {
    code: "",
    pcode: "",
    level: "",
    name: "",
  },
  village: {
    code: "",
    pcode: "",
    level: "",
    name: "",
  },
};

export interface ReturnForm {
  province: AreaInfo;
  city: AreaInfo;
  country: AreaInfo;
  town: AreaInfo;
  village: AreaInfo;
}

export const getAreaCode = (params: any) => {
  return request({
    url: "/open/areaCode/all",
    method: "get",
    params,
  });
};
